/*
 * @Description: 
 * @Author: 闫宇韬(18064986)
 * @Date: 2020-11-25 14:08:47
 * @LastEditTime: 2020-11-25 14:16:28
 * @LastEditors: 闫宇韬(18064986)
 */

 //定义action类型
export const CHANGE_INPUT = 'changeInput'
export const ADD_ITEM = 'addItem'
export const DELETE_TIME = 'deleteItem'


//定义action方法
export const changeInputAction = (value)=>({
    type:CHANGE_INPUT,
    value
})

export const addItemAction = ()=>({
    type:ADD_ITEM
})

export const deleteItemAction = (index)=>({
    type:DELETE_TIME,
    index
})


/**再constructor里面调用
 * constructor(props){
    super(props)
    this.state = {}
    this.setState(store.getState());
    store.subscribe(this.storeChange) //订阅Redux的状态
}

changeInputValue(e){
    const action = changeInputAction(e.target.value)
    store.dispatch(action)
}
clickBtn(){
    const action = addItemAction()
    store.dispatch(action)
}
deleteItem(index){
    const action = deleteItemAction(index)
    store.dispatch(action)
}
**/